﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IList<Prodma.DataAccess.Models.ViewModels.CategoryVm>>" %>

    <div class="listTitleContainer">
        <div class="listTitleCenter-50">#</div>
        <div class="listTitleLeft-200">Adı</div>
        <div class="listTitleCenter-150">Başlık</div>
        <div class="listTitleCenter-150">Bölüm</div>
        <div class="listTitleCenter-50">ID</div>
    </div>

    <%using (Ajax.BeginForm("GetCategoryListAJAX", new AjaxOptions() { UpdateTargetId = "categoryListDiv", OnBegin = "categoryAjaxLoading", OnSuccess = "categoryAjaxLoaded" })) %>
    <% { %>  
         <div class="listRowContainer">
    <% int totalCount = Convert.ToInt32(ViewData["totalRowCount"]) ; %>
    <!-- Bölümlere göre ayrıştırma -->
    <% List<int> categoryCounts = (List<int>)ViewData["categoryCounts"]; %>
    <!-- Listeleme -->
    <% int counter = 1; %>
    <% int seperatorCounter = 0; %>
    <% int same = 0; %>
    <% foreach (int section in (IList<int>)ViewData["sectionList"]) %>
    <% { %>
         <% foreach (Prodma.DataAccess.Models.ViewModels.CategoryVm category in ViewData.Model) %>
         <% { %>
              <% if (Convert.ToInt32(section) == category.Section.Id) %>
              <% { %>
                   <% same++; %>
                   <% if (counter % 2 != 0) %>
                   <% { %>
                       <div class="listRow1">
                          <div class="listColumnCenter-50"><%=counter%></div>
                          <div class="listColumnLeft-200">
                            <a href="#" class="listSelectItemBold" onclick='selectItem(2,<%=category.Id %>);'>
                                <%=category.Name%>
                            </a>
                          </div>
                          <div class="listColumnCenter-150"><%=category.Title%></div>
                          <div class="listColumnCenter-150"><%=category.Section.Name%></div>
                          <div class="listColumnCenter-50"><%=category.Id%></div>
                       </div>
                  <% } %>
                  <% else %>
                  <% { %>
                       <div class="listRow2">
                           <div class="listColumnCenter-50"><%=counter%></div>
                          <div class="listColumnLeft-200">
                            <a href="#" class="listSelectItemBold" onclick='selectItem(2,<%=category.Id %>);'>
                                <%=category.Name%>
                            </a>
                          </div>
                          <div class="listColumnCenter-150"><%=category.Title%></div>
                          <div class="listColumnCenter-150"><%=category.Section.Name%></div>
                          <div class="listColumnCenter-50"><%=category.Id%></div>
                       </div>
                   <% } %>
                   <% counter++; %>
              <% } // if Section.Id == Category.Section.Id %>
         <% } // ForEach Category %>
         <% seperatorCounter++; %>
    <% } // ForEach Section %>
    
    <div class="listFooter">
        <div class="listFooterData">Toplam Kayıt Sayısı : <%=ViewData["totalRowCount"] %></div>
    </div>
    
    <div class="pagerContainer">
       <% Html.RenderPartial("/views/shared/userControls/dataPagerAjax.ascx", new Prodma.DataAccess.Models.UserControlViewModels.DataPagerVm()
       {
           View = "menu",
           TotalRowCount = Convert.ToInt32(ViewData["totalRowCount"]),
           Keys = new List<string>() { "page" },
           Values = new List<string>() { "0" }
       }, new ViewDataDictionary()); %>
    </div>
    
    </div>
<% } %> 


